﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Compiler
{
    public class EbnfConcat : EbnfNode
    {
        EbnfNode first;
        EbnfNode rest;

        public EbnfConcat(EbnfNode first, EbnfNode rest)
        {
            this.first = first;
            this.rest = rest;
        }

        public override EbnfNode Expand(Stack<EbnfAssign> Open)
        {
            first = first.Expand(Open);
            rest = rest.Expand(Open);
            return this;
        }

        public override List<Symbol> ConstructProductionTail(Ebnf2GrammarConvertData data)
        {
            var list = first.ConstructProductionTail(data);
            list.AddRange(rest.ConstructProductionTail(data));
            return list;
        }

        public override string ToString()
        {
            return first.ToString() + " " + rest.ToString();
        }
    }
}
